<?php
include_once( '../drivers/mongo.php' );
include_once( '../drivers/mysql.php' );
function microtime_float()
{
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
}

$text="";
for ($i=0 ; $i < 10;$i++) {
	$text .= ''.mt_rand(0, 9);
}

$i = 0;
$dbObj = new myMongo('10.7.124.23', 'test', 'test');
$dbObj->selectDB('firo');
$dbObj->selectCollection('test20m');
while ($i++ < $argv[1]) {
	$time_start = microtime_float();
	$dbObj->insert(array('text' => $text));
	$time_end = microtime_float();
	$dur = ($time_end - $time_start) * 10000;
	echo $dur."\n";
}
